package domain.entities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * LaboratorioCentral entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "laboratorio_central", catalog = "bms")
public class LaboratorioCentral implements java.io.Serializable {

	// Fields

	private Integer id;
	private Address address;
	private String name;
	private Set<Protocolo> protocolos = new HashSet<Protocolo>(0);

	// Constructors

	/** default constructor */
	public LaboratorioCentral() {
	}

	/** minimal constructor */
	public LaboratorioCentral(Address address, String name) {
		this.address = address;
		this.name = name;
	}

	/** full constructor */
	public LaboratorioCentral(Address address, String name,
			Set<Protocolo> protocolos) {
		this.address = address;
		this.name = name;
		this.protocolos = protocolos;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@JoinColumn(name = "ADDRESSid", nullable = false)
	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "laboratorioCentral")
	public Set<Protocolo> getProtocolos() {
		return this.protocolos;
	}

	public void setProtocolos(Set<Protocolo> protocolos) {
		this.protocolos = protocolos;
	}

}